<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <!--引入Vue-->
  <script type="text/javascript" src="../js/vue.js"></script>
  <title>练习二收集表单数据</title>
</head>

<body>
  <!--准备好一个容器-->
  <div id="root">
    <form action="">
      账号：<input type="text" name="account" v-model="userInfo.account">
      <br><br>
      密码：<input type="password" name="password" v-model="userInfo.password">
      <br><br>
      性别：
      男<input type="radio" name="sex" v-model="userInfo.sex" value="male">
      女<input type="radio" name="sex" v-model="userInfo.sex" value="female">
    <br><br>
    爱好：
    抽烟<input type="checkbox" value="chouyan" v-model="userInfo.hobby">
    喝酒<input type="checkbox" value="hejiu" v-model="userInfo.hobby">
    烫头<input type="checkbox" value="tangtou" v-model="userInfo.hobby">
    <br><br>
    校区：
    <select v-model="userInfo.address">
      <option value="">请选择校区</option>
      <option value="jiangsu">江苏</option>
      <option value="zhejiang">浙江</option>
    </select>
    <br><br>
    其他信息：
    <textarea v-model="other"></textarea>
    </form>

  </div>

  <script type="text/javascript">
    Vue.config.productionTip = false;

    new Vue({
      el: '#root',
      data: {
        userInfo:{
          account:'',//字符串
          password:'',//字符串
          sex:'male',
          hobby:[],//一定要写成数组
          address:'',
          other:''
        }
      }
    })
  </script>
</body>

</html>